﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using VOL;

namespace WebShoes.Admin
{
    public partial class NhaSanXuatManagerForm : System.Web.UI.Page
    {
        NhaSanXuatBL _NhaSanXuatBLL = new NhaSanXuatBL();
        protected void Page_Load(object sender, EventArgs e)
        {
            fillData();
        }

        private void fillData()
        {
            GridView1.DataSource = _NhaSanXuatBLL.GetData();
            GridView1.DataBind();
        }

        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "cmdDelete")
            {
                int maNhaSanXuat = int.Parse(e.CommandArgument.ToString());
                NhaSanXuat obj = new NhaSanXuat();
                obj.MaNhaSanXuat = maNhaSanXuat;
                _NhaSanXuatBLL.deleteNhaSanXuat(obj);
                HangHoaBL _hangHoaBL = new HangHoaBL();
                _hangHoaBL.deleteMaNhaSanXuat(maNhaSanXuat);
                fillData();
            }
        }

        protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {

            GridView1.PageIndex = e.NewPageIndex;
            GridView1.DataBind();
        }
    }
}